<template>
  <div class="modeifyPwdWrapper">
    <div style="height: 2rem;width: 100%;"></div>
    <div class="box">
      <div class="item">
        <div class="box-item">
          <span>原密码:</span>
          <input type="password" v-model="oldPwd" autocomplete="new-password">
        </div>
        <div class="box-item">
          <span>新密码:</span>
          <input type="password" v-model="newPwd" autocomplete="new-password">
        </div>
      </div>
    </div>
    <div class="modify-btn">
       <x-button type="warn" @click="modify">确认修改</x-button>
    </div>
  </div>
</template>

<script>
  import { XButton } from './../../components'
  var LocalStorageUtil = require('./../../commons/js/LocalStorageUtil.js')
  var MyRequest = require('./../../commons/js/MyRequest.js')
  var Global = require("./../../commons/js/Global.js")
  export default {
    data () {
      return {
        oldPwd: '',
        newPwd: '',
        userInfo: LocalStorageUtil.getItem("User")
      }
    },
    components: {
      XButton
    },
     ready: function () {
      Global.closeLoading()
    },
    methods: {
      modify () {
        var data = {
          action: 'modifyPass',
          password: this.newPwd,
          old: this.oldPwd,
          id: this.userInfo.id
        }
         MyRequest.MyGetWithToast("Login", this, function(result, that) {
          history.go(-1)
        }, data)
      }
    }
  }
</script>

<style lang="less">
  @import './changePwd.less';
</style>